/*
 * HexPath.java
 *
 * Created on November 17, 2007, 2:47 PM
 *
 * Copyright (C) 2007-2008  Hylke van der Schaaf
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, in version 3 of the License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
package hextd.hex;

import hextd.Constants;
import java.awt.Graphics2D;
import java.awt.Shape;
import com.usoog.tdcore.gamegrid.GridPoint;
import com.usoog.tdcore.gamestate.GameState;

public class HexPath extends HexBase {

	public static char key = 'p';

	/**
	 * Creates a new instance of HexPath
	 */
	public HexPath(GridPoint location, GameState gs) {
		super(location, gs, false);
		if (canvas != null) {
			borderColor = Constants.colorBaseEmptyHexBorder;
			fillColor = Constants.colorOpenBackGround;
		}
		type = HexType.path;
		shortName = key;
	}

	@Override
	public void paint(Graphics2D g2, int gameTime) {
		if (g2 != null && polyHex != null) {
			g2.setColor(fillColor);
			g2.draw(polyHex);
			g2.fill(polyHex);
		}
	}

	@Override
	public void paintEffects(Graphics2D g2, int gameTime) {
		Shape ph = polyHex;
		if (ph != null) {
			switch (highlight) {
				case placeTower:
					g2.setColor(highlightNOK);
					g2.fill(ph);
					paintRangeCircle(g2);
					break;
				case editHex:
					g2.setColor(highlightOK);
					g2.fill(ph);
					break;
				default:
			}
		}
	}
}
